package com.pp.springboottest.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by lanou on 18/2/27.
 */
@Controller
@RequestMapping("/")
public class HelloController {
    @RequestMapping("hello")
    //@ResponseBody
    public ModelAndView hello(String name,ModelAndView mav){

        List<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        int a = 10;
        mav.addObject("name",name);
        mav.addObject("list",list);
        mav.addObject("flag",a);
        mav.setViewName("hello");
        return mav;
    }
    @RequestMapping("hello1")
    public String hello1(){

        return "hello";
    }
}
